package org.apache.flink.runtime.rest.messages;

import org.apache.flink.runtime.rest.HttpMethodWrapper;
import org.apache.flink.runtime.rest.handler.cluster.ConsumerManagerEnvironmentHandler;

import org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus;

/** Message headers for the {@link ConsumerManagerEnvironmentHandler}. */
public class ConsumerManagerEnvironmentHeaders
        implements RuntimeMessageHeaders<
                EmptyRequestBody, EnvironmentInfo, EmptyMessageParameters> {
    private static final ConsumerManagerEnvironmentHeaders INSTANCE = new ConsumerManagerEnvironmentHeaders();

    public static final String JOB_MANAGER_ENV_REST_PATH = "/consumermanager/environment";

    @Override
    public HttpMethodWrapper getHttpMethod() {
        return HttpMethodWrapper.GET;
    }

    @Override
    public String getTargetRestEndpointURL() {
        return JOB_MANAGER_ENV_REST_PATH;
    }

    @Override
    public Class<EnvironmentInfo> getResponseClass() {
        return EnvironmentInfo.class;
    }

    @Override
    public HttpResponseStatus getResponseStatusCode() {
        return HttpResponseStatus.OK;
    }

    @Override
    public String getDescription() {
        return "Returns the jobmanager environment.";
    }

    @Override
    public Class<EmptyRequestBody> getRequestClass() {
        return EmptyRequestBody.class;
    }

    @Override
    public EmptyMessageParameters getUnresolvedMessageParameters() {
        return EmptyMessageParameters.getInstance();
    }

    public static ConsumerManagerEnvironmentHeaders getInstance() {
        return INSTANCE;
    }
}
